﻿@using BonjourQuotation.UI.Models.PartialModel
@model QuotationLunchDinnerGridViewModel
@{
    //bool functBtn = true;
    //functBtn = !User.IsInRole("accountant");
}
<div id="VendorContractLunchDinner" style="display:none;">
</div>
@using (Ajax.BeginForm("UpdateQuotationLunchDinner", "Quotation", new AjaxOptions() { HttpMethod = "Post", OnComplete = "QuotaValidateComplete", UpdateTargetId = "tabLunchDinner", InsertionMode = InsertionMode.Replace }, new { enctype = "multipart/form-data", id = "QuotaLunchDinnerGridForm" }))
{
   @Html.HiddenFor(model => model.QuotaLunchDinnerErrorCode)
   @Html.HiddenFor(model => model.QuotaLunchDinnerErrorMessage)
   <table class="table table-bordered table-hover">
    <th>#</th>
    <th>Day</th>
    <th>Date</th>
    <th>Lunch</th>
    <th>M</th>
    <th></th>
    <th>g</th>
    <th>f</th>
    <th>Dinner</th>
    <th>M</th>
    <th></th>
    <th>g</th>
    <th>f</th>
    <th>Curr</th>
    @if (Model.QuotaLunchDinRemoveBtnView && !(Model.QuotaLunchDinnerConfirmed))
    {
        <th>del</th>
    }
    <tbody>
        @if (Model.Rows.Count > 0)
        {
            @Html.HiddenFor(model => model.Rows[0].QuotaID)
        }
        @for (int ind = 0; ind < Model.Rows.Count; ind++)
{
    <tr class="@(@Model.Rows[ind].CurrencyLunchDinner == "CA" ? "trCurrencyCad" : "") @(@ind % 2 == 0 ? "trRowBackground1" : "")">
        <td class="tdBorderBlack">@Html.LabelForModel(Model.Rows[ind].LineNo)</td>@Html.HiddenFor(model => model.Rows[ind].LineNo)
        <td class="tdBorderBlack">
            @Html.TextBoxFor(model => Model.Rows[ind].Day, new { @class = "QuotaOnlyDigits QuotaDay QuotaLunchDinnerDay QuotaTextBx table_inputs_50 table_inputs_WithoutBox LunchDetTab" })
        </td>
        @if (Model.Rows[ind].LineDate.Contains("Fri") || Model.Rows[ind].LineDate.Contains("Sat"))
        {
            <td class="tdBorderBlack">
                @Html.LabelForModel(Model.Rows[ind].LineDate, new { @class = "table_inputs_Date QuotaDatesFriSat" })
                @Html.HiddenFor(model => model.Rows[ind].LineDate)
            </td>
        }
        else
        {
            <td class="tdBorderBlack">
                @Html.LabelForModel(Model.Rows[ind].LineDate, new { @class = "table_inputs_Date" })
                @Html.HiddenFor(model => model.Rows[ind].LineDate)
            </td>
        }
        @if (Model.Rows[ind].LunchMFlag == false)
        {
            <td class="tdBorderBlack">
                @Html.TextBoxFor(model => Model.Rows[ind].DescriptionLunch, new { @class = "table_inputs_300 table_inputs_WithoutBox LunchDetTab QuotaTxtComplete" })
                @Html.HiddenFor(model => Model.Rows[ind].LunchVendorID, new { @class = "LunchID" })
            </td>
        }
        else
        {
            <td class="tdBorderBlack">
                @Html.TextBoxFor(model => Model.Rows[ind].DescriptionLunch, new { @class = "table_inputs_300 table_inputs_WithoutBox LunchDetTab" })
                @Html.HiddenFor(model => Model.Rows[ind].LunchVendorID, new { @class = "LunchID" })
            </td>
        }
        <td class="tdBorderBlack">
            @Html.CheckBoxFor(model => Model.Rows[ind].LunchMFlag, new { @class = "QuotaRemTxtComplete LunchDetTab LunchMFlag", @tabindex = "-1" })
        </td>
        <td class="tdBorderBlack">@Html.TextBoxFor(model => Model.Rows[ind].Cost, new { @class = "QuotaOnlyDecimalDigits QuotaTextBx table_inputs_50 table_inputs_WithoutBox LCost MealCost LunchDetTab QuotaMoneyTxb" })</td>
        <td class="tdBorderBlack">@Html.CheckBoxFor(model => Model.Rows[ind].GuideFlag, new { @class = "LunchDetTab" })</td>
        <td class="tdBorderBlack">@Html.CheckBoxFor(model => Model.Rows[ind].FreeFlag, new { @class = "LunchDetTab" })</td>
        @if (Model.Rows[ind].DinnerMFlag == false)
        {
            <td class="tdBorderBlack">
                @Html.TextBoxFor(model => Model.Rows[ind].DescriptionLunchD, new { @class = "table_inputs_300 table_inputs_WithoutBox LunchDetTab QuotaTxtComplete" })
                @Html.HiddenFor(model => Model.Rows[ind].DinnerVendorID, new { @class = "DinnerID" })
            </td>
        }
        else
        {
            <td class="tdBorderBlack">
                @Html.TextBoxFor(model => Model.Rows[ind].DescriptionLunchD, new { @class = "table_inputs_300 table_inputs_WithoutBox LunchDetTab" })
                @Html.HiddenFor(model => Model.Rows[ind].DinnerVendorID, new { @class = "DinnerID" })
            </td>
        }
        <td class="tdBorderBlack">
            @Html.CheckBoxFor(model => Model.Rows[ind].DinnerMFlag, new { @class = "QuotaRemTxtComplete LunchDetTab DinnerMFlag", @tabindex = "-1" })
        </td>
        <td class="tdBorderBlack">@Html.TextBoxFor(model => Model.Rows[ind].CostD, new { @class = "QuotaOnlyDecimalDigits QuotaTextBx table_inputs_50 table_inputs_WithoutBox DCost MealCost LunchDetTab QuotaMoneyTxb" })</td>
        <td class="tdBorderBlack">@Html.CheckBoxFor(model => Model.Rows[ind].GuideFlagD, new { @class = "LunchDetTab" })</td>
        <td class="tdBorderBlack">@Html.CheckBoxFor(model => Model.Rows[ind].FreeFlagD, new { @class = "LunchDetTab" })</td>
        <td class="tdBorderBlack">
            @if (Model.Rows[ind].CurrencyLunchDinner == "CA")
            { 
                @Html.TextBoxFor(model => Model.Rows[ind].CurrencyLunchDinner, new { @class = "QuotaTextBx CurrencyLunchDinner table_inputs_50 table_inputs_WithoutBox LunchDetTab QuotationCurrCAD" })
            }
            else
            {
                @Html.TextBoxFor(model => Model.Rows[ind].CurrencyLunchDinner, new { @class = "QuotaTextBx CurrencyLunchDinner table_inputs_50 table_inputs_WithoutBox LunchDetTab" })
            }
        </td>
        @if (Model.QuotaLunchDinRemoveBtnView && !(Model.QuotaLunchDinnerConfirmed))
        { 
            <td><button class="btndel" type="button" style="padding:0px;" onclick="RemoveLunchDinner('@Model.Rows[ind].LunchID','@Model.Rows[ind].LineNo')"></button></td>
        }
    </tr>
}
    </tbody>
</table>
    if (Model.QuotaLunchDinInsertBtnView && !(Model.QuotaLunchDinnerConfirmed))
    {
        <input type="number" class="QuotaTabInsertTxb" min="1" id="LunchDinnerInsertLine" value="1" />
        <button class="btn14" type="button" onclick="InsertLineLunchDinnerGrid()">Insert</button>
    }
    <div class="pull-right QuotaTabUpdateDivBtn">
        @if (Model.QuotaLunchDinNewLineBtnView && !(Model.QuotaLunchDinnerConfirmed))
        {
            <button class="btn14" type="button" onclick="LunchDinnerNewLine()">New Line</button>
        }
        @if (Model.QuotaLunchDinUpdateBtnView && !(Model.QuotaLunchDinnerConfirmed))
        {
            <button class="btn14" id="LunchTabUpdate" type="button">Validate</button>
        }
    </div>
<div class="row form-row">

    <div class=" col-lg-2 withoutPadding" style="width: 13% !important; margin-left: 30px;">
        <div class="input-group">
            <span class="input-group-addon SumControlsLabelFSize" style="width: 30px !important;">@Html.LabelFor(model => model.GuideSum)</span>
            @Html.LabelForModel(Model.GuideSum, new { @class = "form-control SumControlsFSize" })
        </div>
    </div>
    <div class=" col-lg-2 withoutPadding" style="width: 13% !important;">
        <div class="input-group">
            <span class="input-group-addon SumControlsLabelFSize" style="width: 30px !important;">@Html.LabelFor(model => model.FreeSum)</span>
            @Html.LabelForModel(Model.FreeSum, new { @class = "form-control SumControlsFSize" })
        </div>
    </div>
    <div class=" col-lg-2 withoutPadding" style="width: 13% !important;">
        <div class="input-group">
            <span class="input-group-addon SumControlsLabelFSize" style="width: 30px !important;">@Html.LabelFor(model => model.LunchSum)</span>
            @Html.TextBoxFor(model =>  Model.LunchSum, new { @class = "table_inputs_40 form-control SumControlsFSize" })
        </div>
    </div>
    <div class=" col-lg-2 withoutPadding" style="width: 13% !important;">
        <div class="input-group">
            <span class="input-group-addon SumControlsLabelFSize" style="width: 30px !important;">@Html.LabelFor(model => model.DinnerSum)</span>
            @Html.TextBoxFor(model => Model.DinnerSum, new { @class = "table_inputs_40 form-control SumControlsFSize" })
        </div>
    </div>
    <div class=" col-lg-2 withoutPadding" style="width: 13% !important;">
        <div class="input-group">
            <span class="input-group-addon SumControlsLabelFSize" style="width: 30px !important;">@Html.LabelFor(model => model.LunchDinnerSum)</span>
            @Html.TextBoxFor(model => Model.LunchDinnerSum, new { @class = "table_inputs_40 form-control SumControlsFSize ColorRedBold", @readOnly = true })
        </div>
    </div>
    <div class=" col-lg-2 withoutPadding" style="width: 13% !important;">
        <div class="input-group">
            <span class="input-group-addon SumControlsLabelFSize" style="width: 30px !important;">@Html.LabelFor(model => model.TotalSum)</span>
            @Html.LabelForModel(Model.TotalSum, new { @class = "form-control SumControlsFSize" })
        </div>
    </div>
</div>

}



